<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″/>
    <link rel="stylesheet" type="text/css" href="../../css/defaultcss.css" />
    <link rel="stylesheet" type="text/css" href="../../css/amazeui.min.css" />
    <script type="text/javascript" src="../../js/jquery-1.9.1.min.js"></script>
    <script src='../../js/amazeui.min.js'></script>
    <script src='../../js/flex.js'></script>
    <script type="text/javascript" src="../../layer/layer.js"></script>
    <script type="text/javascript" src="../../js/index.js"></script>
    <link rel="stylesheet" href="../../css/weui.min.css">
    <link rel="stylesheet" href="../../css/css/stylesheets/index.css">
</head>

<body>
    <header>
        <div class="goBack">
            <img src="../../img/base/back.png" alt="返回">
        </div>
        <span class="title"> 检查监督 </span>
    </header>
    <div class="content  law_state">
        <div class="search">
            <div class="search_box">
                <span class="icon">
                </span>
                <input type="text" id="search_text" placeholder="搜索名称、内容">
                <span class="btn" id="search_btn">搜索</span>
            </div>
        </div>
        <ul class="case_list" id="caseList">
        </ul>
        <div class="loading" id="loading">
            <img src="../../img/loading.gif" alt="">
        </div>
        <div class='loadData' id="loadData">
            <span class='line line1'>
			</span>
            <span>
				已经到底啦~
			</span>
            <span class='line line2'>
			</span>
        </div>
        <div class="fixed_bottom ">
            <span class="active">
				<a href="javascript:void(0);">
					检查监督
				</a>
			</span>
            <span>
				<a href="./law_notice.html">
					我的反映
				</a>
			</span>
        </div>
    </div>

</body>

</html>

<script type="text/javascript ">
    $('.goBack').bind('click', function () {
        window.history.back()
    })
    var isLoading = true, //loading  ui
        messagePage = 1, //当前页面
        loadingState = true; //请求状态
    $('#loading').hide();
    $("#loadData").hide();
    var getData = function (pageNo, screen) {
        if (isLoading && loadingState) {
            loadingState = false;
            HYIP.ajax({
                url: '/twoLaw/noticeList.action',
                type: 'get',
                data: {
                    screen: screen,
                    pageSize: 10,
                    pageNo: pageNo
                }
            }, function (data) {
                loadingState = true;
                var list = data.data.list;
                var caseList = '';
                for (var i = 0; i < list.length; i++) {
                    caseList += '<li>                                                             ' +
                        '    <a href="./state_detail.html?id=' + list[i].id +
                        '">                               ' +
                        '        <div class="title">                                      ' +
                        list[i].name +
                        '            <div class="line">                                   ' +
                        '            </div>                                               ' +
                        '        </div>                                                   ' +
                        '        <div class="detail">                                     ' +
                        list[i].detail +
                        '        </div>                                                   ' +
                        '        <div class="bottom">                                     ' +
                        '            <div class="date">                                   ' +
                        list[i].createTime +
                        '            </div>                                               ' +
                        '            <div class="btn">                                    ' +
                        '                查看详情                                         ' +
                        '            </div>                                               ' +
                        '        </div>                                                   ' +
                        '    </a>                                                         ' +
                        '</li>                                                            '
                }
                $('#caseList').text('').append(caseList);
                if (data.data.hasNextPage) {
                    isLoading = true;
                    hasNextPage = true;
                    $('#loadData').hide();
                } else {
                    isLoading = false;
                    hasNextPage = false;
                    $('#loadData').show();
                    $("#loading").hide();
                }
            });
        }
    }
    getData(messagePage, '');
    $(window).scroll(function () {
        if (hasNextPage == true) {
            if (($("body").height() - $("body").scrollTop()) <= document.documentElement.clientHeight) {
                $("#loading").show();
                messagePage++;
                getData(messagePage);
            }
        }
    });
    $("#search_btn").bind('click', function () {
        var screen = $("#search_text").val();
        getData(1, screen);
        isLoading = true;
        hasNextPage = true;
    })
</script>